#include <iostream>
#include<assert.h>

using namespace std;


class node
{
int data;
node * next;
public:
node() :data(0), next(NULL) {}
node(int d) :data(d), next(NULL) {}
int getData() {return data;}
void setData(int d){data =d;}
node * getNext() {return next;}
void setNext( node * n) {next=n;}
friend class list;
};

class list
{
node * chain;
node *tail;
public:
list();

void insertTail(int data)
{
	cout<<"data arrived   "<<data <<endl;
	node* temp=new node();
	temp->data=data;
	temp->next=nullptr;
	if(chain ==nullptr)
	{
		chain =temp;
		tail=temp;
		return;
	}
	tail->next=temp;
	tail=temp;

}

void removeHead(){

	if(chain==nullptr)
		return;
	if(chain->next==nullptr){
		tail=chain->next;
	}
	chain=chain->next;
}

node* getHead(){
	return chain;

}

int size(){

      int size=0;
	node *p=chain;
	while(p!=nullptr){

	size ++;

		p=p->next;
	}

	//cout<<size<<endl;
	return size;
}

bool isEmpty(){

	if(chain ==nullptr)
		return true;
	return false;
}

};
list::list() : chain(nullptr) {tail=nullptr;}

class Queue{ 
  public: 
      Queue( ) { };
      void enqueue(int x) {q.insertTail(x);};
      int peekHead( ) {assert(size()>0); return q.getHead( )->getData( );}; 
     // int peekTail( ) {assert(size()>0); return q.getTail( )->getData( );}; 
      int dequeue( ) {assert(size()>0);  int x=peekHead( );
                           q.removeHead( ); return x;}; 
      int size( ) {return q.size( );};
      bool isEmpty( ) {return q.isEmpty( );};  
  
	 
  private:
      list q;


 };   
